package com.zxbg.controller.systemtoolsController;

import com.zxbg.controller.Code;
import com.zxbg.controller.Result;
import com.zxbg.domain.InfoBlockMenu;
import com.zxbg.service.systemtoolsService.InfoBlockMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/InfoBlockMenu")
public class InfoBlockMenuController {
    @Autowired
    InfoBlockMenuService infoBlockMenuService;

    @GetMapping
    public Result getAllInfoBlockMenu(@RequestHeader Integer tenant_id) {
        List<InfoBlockMenu> infoBlockMenuList = infoBlockMenuService.getAllInfoBlockMenu(tenant_id);
        return new Result(Code.GET_OK, infoBlockMenuList);
    }

    @PutMapping
    public Result updateInfoBlockMenu(@RequestBody InfoBlockMenu infoBlockMenu, @RequestHeader Integer tenant_id) {
        boolean flag = infoBlockMenuService.updateInfoBlockMenu(infoBlockMenu, tenant_id);
        return new Result(flag ? Code.UPDATE_OK : Code.UPDATE_ERR, flag);
    }
}
